package com.study.juc.cf;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @program: juc-study
 * @author: Zhoujian
 * @date: 2022-08-10 20:54
 * @version: 1.0
 * @description: FutureTask 复习
 **/
public class FutureTaskDemo {
	public static void main(String[] args) throws ExecutionException, InterruptedException {
		FutureTask<String> stringFutureTask = new FutureTask<>(new MyThread2());
		Thread thread = new Thread(stringFutureTask);
		thread.start();
		System.out.println(stringFutureTask.get());
	}
}

class MyThread implements Runnable{
	@Override
	public void run() {

	}
}

class MyThread2 implements Callable<String>{

	@Override
	public String call() throws Exception {
		System.out.println("111111111111");
		return "Callable call";
	}
}